<template>
  <div class="mystars">
    <myheader title='我的收藏'>
      <template #left>
        <van-icon name="arrow-left"
                  @click="$router.go(-1)" />
      </template>
    </myheader>
    <mypostBlock v-for='item in starList'
                 :key='item.id'
                 :post='item'
                 @click.native="$router.push({path: `/postDetail/${item.id}`})"></mypostBlock>
  </div>
</template>

<script>
import myheader from '@/components/myheader.vue'
import mypostBlock from '@/components/mypostBlock.vue'
import { getStarList } from '@/apis/user.js'
import { starPostById} from '@/apis/post'
export default {
  components: {
    mypostBlock, myheader
  },
  data () {
    return {
      starList: []
    }
  },
  mounted () {
    getStarList()
      .then(res => {
        console.log(res);
        this.starList = res.data.data
      })
  },
  methods:{
       removeStar (id, index) {
      console.log(id);
      starPostById(id)
      this.starList.splice(index, 1)
    }
  }
}
</script>

<style>
</style>